package com.midele.goodstuff.ui.main.screen

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.PagerState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController


@OptIn(ExperimentalFoundationApi::class)
@Composable
internal fun HomeRoute(
    modifier: Modifier = Modifier,
    navController: NavHostController,
    pageState: PagerState,
) {
    HomeScreen(
        modifier = modifier,
        navController = navController,
        pageState = pageState,
    )
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeScreen(
    modifier: Modifier,
    navController: NavHostController,
    pageState: PagerState,
) {
    HorizontalPager(
        userScrollEnabled = false,
        state = pageState,
        modifier = Modifier.fillMaxSize(),
    ) { pager ->
        when (pager) {
            0 -> {
                ExploreRoute(navController = navController)
            }

            1 -> {
                RecordRoute(navController = navController)
            }
            2 -> {
                RecordRoute(navController = navController)
            }
            3 -> {
                MineRoute(navController = navController)
            }
        }
    }


}
